home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 2
/
Aminet AMIGA CDROM (1994)(Walnut Creek)[Feb 1994][W.O. 44790-1].iso
/
Aminet
/
os20
/
util
/
random.readme
< prev
next >
Wrap
Text File
|
1992-12-07
|
2KB
|
52 lines
Short: Choose file randomly (for e.g. WB picture)
Random
------
Note: Random requires OS2.0 or above.
Bored with the same old Workbench picture/pattern/palette etc. at
boot-time? Wish you could boot up with a preference selected randomly from
your favourites? Then you need...Random.
Random was designed with the above in mind, but could probably be applied
to all sorts of (un)useful situations.
Random takes one option, a pattern to match. It finds all files that match
the pattern, and echos one 'randomly'. The randomness is done by
calculating the system time in seconds and taking the remainder on division
by the number of matching files. So, Random run quickly in succession will
not produce a random sequence, but it does when run over a sequence of
boots (don't ask me for a proof, though).
For example, I use NickPrefs to put a picture on my Workbench, and for each
of my pictures, have created a 'Preset' file using the WBPicture
preferences editor. Let's say I put them all in the sys:prefs/presets
drawer, giving each a '.wbpic' extension.
I can then get NickPrefs to use one randomly by using backtick
substitution, adding the following line to my Startup-sequence:
copy `random sys:prefs/presets/#?.wbpic` env:sys/wbpicture.prefs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
inserts randomly selected file
immediately AFTER the line that looks a bit like
copy >NIL: ENVARC: ram:env all quiet noreq
This procedure could be modified for any other prefs file, and other things
too.
Placed in the public domain, with source in SAS C (v5.10), and with NO
WARRANTIES attached. If you want enhancements made to Random, try to do
them yourself first before asking me (I'm a busy man...). I do find time to
read fan mail, though :)
Finally, there aren't enough uploads of pictures suitable for
backdrops/tiling; if you've got some decent ones, share them!
You have been listening to...
Martin Scott email: mws@castle.ed.ac.uk 'til June 1993
December '92